package com.shen.module_room.dao

import androidx.room.*
import com.shen.module_room.bean.UserInfoBean

/**
 * author:  shen
 * date:    2020/7/5
 */
@Dao
interface UserInfoDao: BaseDao<UserInfoBean> {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(element : UserInfoBean)

    @Query("select * from user_info")
    fun getAllUser():MutableList<UserInfoBean>?

    @Query("select * from user_info where user_id = :userId")
    fun getUserByUserId(userId : Long): UserInfoBean?

    @Query("select * from user_info where phone = :phone")
    fun getUserByPhone(phone : String): UserInfoBean?

    @Query("delete from user_info")
    fun deleteAll()

    @Query("delete from user_info where user_id = :userId")
    fun deleteByUserId(userId : Long)

}